package com.gjl.jieshou;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;



@Component
public class Jieshou {
    //类上添加@component注解
//    @RabbitListener(queues = "Bmessage")
//    public void receiverA(Message message, Channel channel){
//        System.out.println("收到消息！:"+new String(message.getBody()));
//    }

    @RabbitListener(queues = "word")
    public void receiverA(Message message, Channel channel){
        System.out.println("收到消息！:"+new String(message.getBody()));
    }


    //死信队列接收消息和正常队列相同
//    @RabbitListener(queues = "deadLetterQueue1")
//    public void receiverC(Message message, Channel channel){
//        System.out.println("收到死信"+new String(message.getBody()));
//    }
}
